package com.wust.supermarket.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wust.supermarket.dao.StaffDao;
import com.wust.supermarket.domain.Staff;
import com.wust.supermarket.service.StaffService;
@Service
public class StaffServiceImpl implements StaffService {
	@Resource
    
	private StaffDao staffDao;
    //查询所有员工
	public List<Staff> listAllStaffs() {
		// TODO Auto-generated method stub
		return staffDao.listAllStaffs();
	}

	
	public Staff getStaffById(int staffId) {
		// TODO Auto-generated method stub
		return staffDao.getStaffById(staffId);
	}


	public int insertStaff(Staff staff) {
		// TODO Auto-generated method stub
		return staffDao.insertStaff(staff);
	}


	public int updateStaff(Staff staff) {
		// TODO Auto-generated method stub
		return staffDao.updateStaff(staff);
	}


	public int deleteStaff(int staffId) {
		// TODO Auto-generated method stub
		return staffDao.deleteStaff(staffId);
	}
	
	@Override
	public Staff getStaffByName(String staffUsername, String staffPassword) {
		// TODO Auto-generated method stub
		return staffDao.getStaffByName(staffUsername, staffPassword);
	}

	@Override
	public int getStaffNum() {
		List<Staff>staffList=staffDao.listAllStaffs();
		return staffList.size();
	}
}
